﻿namespace Sai.Core
{
	using System;
	using System.Collections.Generic;

	/// <summary>
	/// Compare based on name only.
	/// </summary>
	internal sealed class ProductAssemblyNameComparer : IEqualityComparer<ProductAssembly>
	{
		public bool Equals(ProductAssembly x, ProductAssembly y)
		{
			const int ExactMatch = 0;
			bool same = string.Compare(
								x.Name,
								y.Name,
								StringComparison.OrdinalIgnoreCase)
								== ExactMatch;

			return same;
		}

		public int GetHashCode(ProductAssembly obj)
		{
			return obj.Name.GetHashCode();
		}
	}
}
